<?php

class rittenSubApp extends application {

    public $defaultPage = 'rittenOverzicht';

    public function init(){

        # Add some pages
        $this->addPage('rittenoverzicht','pageRittenOverzicht();');
        $this->addPage('aanmeldenrit','pageAanmeldenRit();');

        parent::init();

    }

    public function pageRittenOverzicht() {

       $page = $this->createMainPage('Overzicht mijn ritten', 'subpage');

       $page->append('<h1>Mijn ritten</h1><br/><br/>','content');

       $query = "SELECT * FROM ritten WHERE Klant_ID = '".$_SESSION['klantid']."'";
       $result = mysql_query($query);

       $page->appendTemplate('rititem','content',true);
       $page->append('<b>Van</b>','start',true);
       $page->append('<b>Naar</b>','eind',true);
       $page->append('<b>Datum</b>','datum',true);

       
       while($line = mysql_fetch_assoc($result)){
           
           $page->appendTemplate('rititem','content',true);
           $page->append($line['Start_Woonplaats']. '<br/>' . $line['Start_Straat'],'start',true);
           $page->append($line['Eind_Woonplaats']. '<br/>' . $line['Eind_Straat'],'eind',true);
           $page->append($line['Datum'],'datum',true);

        }

       return $page;

    }

    public function pageAanmeldenRit() {

            $page = $this->createMainPage('Aanmelden rit', 'subpage');

            $page->append('<h1>Rit aanmelden</h1><br/>  ','content');
            $this->loadForm('aanmeldenritform', $page, 'content');

            return $page;

    }

}

?>
